import * as ActionTypes from "./constant";

const init = {
    counter: 0,
};

export default function reducer(state = init, action) {
    switch (action.type) {
        case ActionTypes.PLUS:
            return { ...state, counter: state.counter + action.data };

        case ActionTypes.MINUS:
            return { ...state, counter: state.counter - action.data };
        default:
            return state;
    }
}
